child_process: emit close on parent stdin when child closes fd 0#62945
Closed
maruthang wants to merge 1 commit intonodejs:mainfrom
Closed
child_process: emit close on parent stdin when child closes fd 0#62945maruthang wants to merge 1 commit intonodejs:mainfrom
maruthang wants to merge 1 commit intonodejs:mainfrom
Conversation
Since PR nodejs#18701 the parent's child.stdin Socket stopped emitting `close` because the Socket is constructed with readable: false, which suppresses the constructor's read(0) call. Without the libuv read loop, the kernel's EOF/HUP signal (raised when the child closes its end of the stdin pipe) is never observed, so the close cascade never runs. Install a minimal onread callback on the underlying Pipe handle and call pipe.readStart() so EOF is delivered. The callback only acts on UV_EOF and calls socket.destroySoon() so pending writes drain. Unexpected inbound data is absorbed via readStop() so the read side-channel is not resurrected. Fixes: nodejs#25131 Signed-off-by: Maruthan G <[email protected]>
Member
|
Still think the approach discussed in #62353 is the way to go here |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since PR #18701 the parent's child.stdin Socket stopped emitting
closebecause the Socket is constructed with readable: false,which suppresses the constructor's read(0) call. Without the libuv
read loop, the kernel's EOF/HUP signal (raised when the child
closes its end of the stdin pipe) is never observed, so the close
cascade never runs.
Install a minimal onread callback on the underlying Pipe handle
and call pipe.readStart() so EOF is delivered. The callback only
acts on UV_EOF and calls socket.destroySoon() so pending writes
drain. Unexpected inbound data is absorbed via readStop() so the
read side-channel is not resurrected.
Fixes: #25131
Note: I was unable to run the test suite locally on Linux/macOS (no built
out/Release/nodeon this Windows host; named-pipe EOF semantics on Windows differ, hence the test guard). The fix matches the reporter's documented workaround and Tseian's analysis on the issue thread. Looking forward to CI verification on Linux/macOS runners.